diff options
Diffstat (limited to 'examples/blog-multiple-authors/src/pages/posts/[...page].astro')
-rw-r--r-- | examples/blog-multiple-authors/src/pages/posts/[...page].astro | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/examples/blog-multiple-authors/src/pages/posts/[...page].astro b/examples/blog-multiple-authors/src/pages/posts/[...page].astro index 65b4067fc..b615d762f 100644 --- a/examples/blog-multiple-authors/src/pages/posts/[...page].astro +++ b/examples/blog-multiple-authors/src/pages/posts/[...page].astro @@ -3,20 +3,8 @@ import MainHead from '../../components/MainHead.astro'; import Nav from '../../components/Nav.astro'; import PostPreview from '../../components/PostPreview.astro'; import Pagination from '../../components/Pagination.astro'; - -// page -let title = 'Don’s Blog'; -let description = 'An example blog on Astro'; -let canonicalURL = Astro.request.canonicalURL; - -// collection -interface MarkdownFrontmatter { - date: number; - description: string; - title: string; -} - import authorData from '../../data/authors.json'; + export async function getStaticPaths({paginate, rss}) { const allPosts = Astro.fetchContent<MarkdownFrontmatter>('../post/*.md'); const sortedPosts = allPosts.sort((a, b) => new Date(b.date).valueOf() - new Date(a.date).valueOf()); @@ -39,6 +27,19 @@ export async function getStaticPaths({paginate, rss}) { return paginate(sortedPosts, {pageSize: 1}); } +// page +let title = 'Don’s Blog'; +let description = 'An example blog on Astro'; +let canonicalURL = Astro.request.canonicalURL; + +// collection +interface MarkdownFrontmatter { + date: number; + description: string; + title: string; +} + + const { page } = Astro.props; --- |